package com.sbeam.controller;

import com.sbeam.service.HomeService;
import com.sbeam.vo.HomeVo;
import com.sbeam.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/home")
public class HomeController {

    @Autowired
    private HomeService homeService;

    @GetMapping("/getHomeList")
    public SysResult getHomeList(){
        HomeVo homeVo = homeService.getHomeVo();
        if (homeVo.getSortList().isEmpty() || homeVo.getGamesShowList().isEmpty()){
            return SysResult.failed();
        }
        return SysResult.success(homeVo);
    }

}
